package com.moss.cloud.plugins.api.contant.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum TemplateEnum {
    ENTITY("entity.java.ftl","实体类模板"),
    FROM("form.java.ftl","from参数模板"),
    PARAM("param.java.ftl","查询参数模板"),
    MAPPER("mapper.java.ftl","mapper模板"),
    SERVICE("service.java.ftl","SERVICE模板"),
    SERVICE_IMPL("serviceImpl.java.ftl","SERVICE_IMPL模板"),
    CONTROLLER("controller.java.ftl","CONTROLLER模板");
    private final String tempName;
    private final String tempDesc;

    @Data
    public static class EnumEntity{
        private String tempName;
        private String tempDesc;
    }

    public static List<EnumEntity> enumList(){
        return Arrays.stream(TemplateEnum.values()).map(item -> {
            EnumEntity enumEntity = new EnumEntity();
            enumEntity.setTempName(item.getTempName());
            enumEntity.setTempDesc(item.getTempDesc());
            return enumEntity;
        }).collect(Collectors.toList());
    }
}
